package gen.tools.delivery;

import gen.tools.Widgets;
import gen.tools.structures.S2;
import gen.tools.structures.S4;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

public class GetParameter4SDEL extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public GetParameter4SDEL() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		final Widgets wid = new Widgets();
		request.setCharacterEncoding( wid.UIcodeSet );
		response.setContentType("application/json");
		response.setCharacterEncoding( wid.UIcodeSet );
		
		final S4 ftpInfo = new S4();
		try {
			ftpInfo.setS1( wid.getSysParameter("ftpIp") );
			ftpInfo.setS2( wid.getSysParameter("ftpId") );
			ftpInfo.setS3( wid.getSysParameter("ftpPwd") );
			ftpInfo.setS4( wid.getSysParameter("ftpPath") );
		} catch (Exception e) {
			wid.errLog(e);
		}
		
		response.getWriter().write( new Gson().toJson(ftpInfo) );	
	}

}
